package org.tangolyricstagger.model;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Set;
import java.util.TreeSet;

import lombok.Getter;

@Getter
public class TagScanResults {
    private Set<String> ignoredGenres = new TreeSet<String>();
    private Map<String, Long> genreStatistics = new HashMap<String, Long>();
    private List<TagInfo> tagInfos = new ArrayList<TagInfo>();

    public boolean containsIgnoredGenre(String genre) {
        return ignoredGenres.contains(genre);
    }

    public void addIgnoredGenre(String genre) {
        ignoredGenres.add(genre);
    }

    public void addTagInfo(TagInfo tagInfo) {
        String genre = tagInfo.getGenre();
        if (!genreStatistics.containsKey(genre)) {
            genreStatistics.put(genre, 1L);
        } else {
            Long count = genreStatistics.get(genre);
            genreStatistics.put(genre, ++count);
        }
        tagInfos.add(tagInfo);
    }

    public void sortTagInfos() {
        Collections.sort(tagInfos);
    }
}
